﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using BaseEntities;
using DataAccess;

namespace BussinessLogic
{
    public class StockBLL
    {
        DataAccess.DataAccess DB = new DataAccess.DataAccess(); 
        public int GetQuantity(int ATMID, int MoneyID)
        {
            string query = "EXEC [GetQuantity] @ATMID, @MoneyID";
            SqlParameter paramATMID = new SqlParameter("@ATMID", ATMID);
            SqlParameter paramMoneyID = new SqlParameter("@MoneyID", MoneyID);
            Stock st = new Stock();
            st.Quantity = DB.GetQuantity(query, paramATMID, paramMoneyID);
            return st.Quantity;
        }
        public void UpdateQuantity(int ATMID, int MoneyID, int Quantity)
        {
            string query = "EXEC [UpdateQuantity] @ATMID, @MoneyID, @Quantity";
            SqlParameter paramATMID = new SqlParameter("@ATMID", ATMID);
            SqlParameter paramMoneyID = new SqlParameter("@MoneyID", MoneyID);
            SqlParameter paramQuantity = new SqlParameter("@Quantity", Quantity);
            DB.UpdateData(query, paramATMID, paramMoneyID, paramQuantity);
        }
    }
}
